package com.evil.formula.pojo.dto;

import com.evil.common.core.entity.R;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author liyang
 * @date 2022-08-08 00:00
 */
public class Result<T> extends R<T> {

    public boolean succeed() {
        return ResultCodeEnum.SUCCESS.getCode() == this.getCode();
    }

    public boolean unSucceed() {
        return !this.succeed();
    }

    @Getter
    @AllArgsConstructor
    private enum ResultCodeEnum {
        SUCCESS(0, "操作成功"),
        FAIL(-2, "操作失败"),
        ;

        /**
         * code
         */
        private final int code;
        /**
         * message
         */
        private final String message;
    }
}
